package com.xzl.shop.server;

import com.xzl.shop.dao.IUserDao;
import com.xzl.shop.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServer {
    @Autowired
    private IUserDao userDao;
    public List<User> selectUser(User user){
        if(user!=null) return userDao.selectUser(user);
        return null;
    }
    public Integer add(User user){
        Integer i = 0;
        if(user!=null) i = userDao.insertUser(user);
        return i;
    }
    public Integer setMoney(User user){
        if(user.getId()==null||user.getMoney()==null) return 0;
        else return userDao.setMoney(user);
    }
}
